﻿@using Compass.Wasm.Shared.Logistics
@inject NavigationManager NavigationManager
@inject IJSRuntime JsRuntime

<tr>
    @if (ImportExportInfoDto is null) { }
    else
    {
        <td style="text-overflow: ellipsis; overflow: hidden; white-space: nowrap">
            <CompUpdateIcon Roles="admin,log" Url="@($"importexportinfo/update/{ImportExportInfoDto.Id}")"/>
            <a href="importexportinfo/@ImportExportInfoDto.Id">@ImportExportInfoDto.MtlNumber</a>
        </td>
        <td style="text-align: center">@ImportExportInfoDto.Type</td>
        <td style="text-align: center">@ImportExportInfoDto.Sbu</td>
        <td style="text-overflow: ellipsis; overflow: hidden; white-space: nowrap">@ImportExportInfoDto.Name</td>
        <td >@ImportExportInfoDto.HsCode</td>
        <td style="text-overflow: ellipsis; overflow: hidden; white-space: nowrap">@ImportExportInfoDto.HsDescription</td>
        <td style="text-align: center">@ImportExportInfoDto.PlaceOfOrigin</td>
        <td style="text-align: center">
            <span @onclick="Show" hidden="@(string.IsNullOrWhiteSpace(ImportExportInfoDto.DeclarationElements))">@(_showDeclarationElements ? "▲" : "▼")</span>
        </td>
    }
</tr>
@if (_showDeclarationElements)
{
    <tr>
        <td colspan="8" style="color: red">
            <CompMultiLineText Text="@ImportExportInfoDto.DeclarationElements" />
        </td>
    </tr>
}

@code {
    [Parameter]
    public ImportExportInfoDto? ImportExportInfoDto { get; set; }
    private bool _showDeclarationElements = false;//显示申报要素
    private void Show()
    {
        _showDeclarationElements = !_showDeclarationElements;
    }
}
